package hummer.task;

import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

/**
 * Created by IntelliJ IDEA.
 * User: Administrator
 * Date: 14-8-24
 * Time: 下午10:10
 * To change this template use File | Settings | File Templates.
 */
public class TaskScanner {

    private final ScheduledExecutorService scheduledExecutorService  = Executors.newSingleThreadScheduledExecutor();

    private long initialDelay;

    private long period;

    public void init(){


        scheduledExecutorService.scheduleWithFixedDelay(new Task(), initialDelay, period, TimeUnit.MILLISECONDS);

    }

    public void setInitialDelay(long initialDelay) {
        this.initialDelay = initialDelay;
    }

    public void setPeriod(long period) {
        this.period = period;
    }

    private class Task implements Runnable{

        public void run() {
            //To change body of implemented methods use File | Settings | File Templates.
        }
    }

}
